<link rel="stylesheet" href="/assets/css/jquery-ui.css" />
<script src="/assets/js/jquery-1.9.1.js"></script>
<script src="/assets/js/jquery-ui.js"></script>
<script>
    $(function() {
        $( "#datepicker" ).datepicker({dateFormat: "yy-mm-dd"});
    });
</script>

<div class="textos">
    <table style="width: 80%;" align="center">
        <tr>
            <td>
                <div class="titulos"><?=strtoupper($segmento).' / '.$idiomat?></div><br>
                Choose Language: <select name="idioma" onchange="change(this)">
                    <option value="">Choose...</option>
                    <option value="ar">Arabic</option>
                    <option value="en">English</option>
                    <option value="es">Spanish</option>
                    <option value="pt">Portuguese</option>
                </select>
                

                <script type="text/javascript">
                    function change(sel) {
                        window.location.href='/panel/<?=$segmento?>/'+sel.options[sel.selectedIndex].value+'/';
                    }
                </script>

                <form method="post" enctype="multipart/form-data">
                    Fecha: <input type="text" id="datepicker" name="fecha"><br>
                    Imagen: <input type="file" name="imagen" accept="image/*"><br>
                    Párrafo: <textarea name="parrafo" rows="7" cols="50"></textarea><br>
                    PDF: <input type="file" name="pdf" size="20" accept="application/pdf"><br>
                    <input type="submit" value="ADD">
                </form>

                <br><br>
                <table border="1">
                    <tr>
                        <th>Fecha</th>
                        <th>Imagen</th>
                        <th>Parrafo</th>
                        <th>PDF</th>
                        <td></td>
                    </tr>
                <?php foreach($news as $new) { ?>
                    <tr>
                        <td><?=$new['fecha']?></td>
                        <td><a href="<?=$new['imagen']?>" target="__blank">Imagen</a></td>
                        <td><?=$new['parrafo']?></td>
                        <td><a href="<?=$new['pdf']?>" target="__blank">PDF</a></td>
                        <td><a href="/panel/delete/<?=$segmento?>/<?=$idioma?>/<?=$new['idnews']?>/">Delete</a></td>
                    </tr>
                <?php } ?>
                </table>
            </td>
        </tr>
    </table>
</div>